﻿Ext
		.onReady(function() {
			Ext.QuickTips.init();
			Ext.form.Field.prototype.msgTarget = 'under';
		
			
			
			var courses = new Ext.data.Record.create( [ {
				name : 'course_id',
				type : 'int'
			},  {
				name : 'course_name',
				type : 'string'
			} ,{
				name : 'course_code',
				type : 'string'
			}
			]);
			var coursestore = new Ext.data.Store( {
				proxy : new Ext.data.HttpProxy( {
					url : '/schedule/queryCourse'
				}),
				reader : new Ext.data.JsonReader( {
					totalProperty : 'totalProperty',
					root : 'root'
				}, courses),
				remoteSort : true
			});
			coursestore.load();
			var courseSm = new Ext.grid.CheckboxSelectionModel();
			var courseCols = new Ext.grid.ColumnModel( [ new Ext.grid.RowNumberer(),
			       courseSm, {
						header : '课程名称',
						dataIndex : 'course_name'
					}, {
						header : '课程编号',
						dataIndex : 'course_code'
					}]);
			courseCols.defaultSortable = true;

			var courseGrid = new Ext.grid.GridPanel(
					{
						title : '课程信息列表',
						region : 'west',
						buttonAlign : "left",
						width : 450,
						height : 460,
						loadMask : true,
						store : coursestore,
						disableSelection : false,
						cm : courseCols,
						sm :courseSm,
						viewConfig : {
							forceFit : true
						},
						bbar : new Ext.PagingToolbar( {
							store : coursestore,
							pageSize : 15,// 页大小
							displayInfo : true,// 是否显示displayMsg
							displayMsg : "本页显示第{0}条到第{1}条的记录,一共{2}条",
							emptyMsg : "没有记录"// 如果没有记录，则显示该文本
						})
					});
			var courseform = new Ext.form.FormPanel( {
				id : 'courseform',
				width : 450,
				height : 460,
				renderTo:'foot2',
				hideBorders : true,
				labelWidth : 80,
				labelAlign : "right",
				items :courseGrid
			});
			
			
			var teachers = new Ext.data.Record.create( [ {
				name : 'teachers_id',
				type : 'int'
			}, {
				name : 'teachers_name',
				type : 'string'
			}, {
				name : 'teachers_code',
				type : 'string'
			} ]);
			

			var teacherstore = new Ext.data.Store( {
				proxy : new Ext.data.HttpProxy( {
					url : '/schedule/queryTeachers'
				}),
				reader : new Ext.data.JsonReader( {
					totalProperty : 'totalProperty',
					root : 'root'
				}, teachers),
				remoteSort : true
			});
			teacherstore.load();
			var teacherSm = new Ext.grid.CheckboxSelectionModel();
			var teacherCols = new Ext.grid.ColumnModel( [ new Ext.grid.RowNumberer(),
			           teacherSm, {
						header : '教师姓名',
						dataIndex : 'teachers_name'
					},{
						header : '教师编号',
						dataIndex : 'teachers_code'
					}]);
			teacherCols.defaultSortable = true;

			var teacherGrid = new Ext.grid.GridPanel(
					{
						title : '教师信息列表',
						region : 'center',
						buttonAlign : "left",
						width : 450,
						height : 460,
						loadMask : true,
						store : teacherstore,
						disableSelection : false,
						cm : teacherCols,
						sm :teacherSm,
						viewConfig : {
							forceFit : true
						},
						bbar : new Ext.PagingToolbar( {
							store : teacherstore,
							pageSize : 15,// 页大小
							displayInfo : true,// 是否显示displayMsg
							displayMsg : "本页显示第{0}条到第{1}条的记录,一共{2}条",
							emptyMsg : "没有记录"// 如果没有记录，则显示该文本
						})
					});
			var teacherform = new Ext.form.FormPanel( {
				id : "form",
				width : 450,
				height :460,
				renderTo:'foot1',
				hideBorders : true,
				labelWidth : 80,
				labelAlign : "right",
				items :teacherGrid
			});
			
			var classes = new Ext.data.Record.create( [ {
				name : 'classes_id',
				type : 'int'
			}, {
				name : 'classes_name',
				type : 'string'
			},{
				name : 'classes_code',
				type : 'string'
			}]);
			
			var classesstore = new Ext.data.Store( {
				proxy : new Ext.data.HttpProxy( {
					url : '/schedule/queryClasses'
				}),
				reader : new Ext.data.JsonReader( {
					totalProperty : 'totalProperty',
					root : 'root'
				}, classes),
				remoteSort : true
			});
			classesstore.load();
			var classesSm = new Ext.grid.CheckboxSelectionModel();
			var classesCols = new Ext.grid.ColumnModel( [ new Ext.grid.RowNumberer(),
			           teacherSm, {
						header : '班级名称',
						dataIndex : 'classes_name'
					},{
						header : '班级编号',
						dataIndex : 'classes_code'
					}]);
			classesCols.defaultSortable = true;

			var classesGrid = new Ext.grid.GridPanel(
					{
						title : '教师信息列表',
						region : 'center',
						buttonAlign : "left",
						width : 450,
						height : 460,
						loadMask : true,
						store : classesstore,
						disableSelection : false,
						cm : classesCols,
						sm :classesSm,
						viewConfig : {
							forceFit : true
						},
						bbar : new Ext.PagingToolbar( {
							store : classesstore,
							pageSize : 15,// 页大小
							displayInfo : true,// 是否显示displayMsg
							displayMsg : "本页显示第{0}条到第{1}条的记录,一共{2}条",
							emptyMsg : "没有记录"// 如果没有记录，则显示该文本
						})
					});
			
			var classesform = new Ext.form.FormPanel( {
				id : "classesform",
				width : 450,
				height : 460,
				renderTo:'foot3',
				hideBorders : true,
				labelWidth : 80,
				labelAlign : "right",
				items :classesGrid
			});
		

		});